import React, { Component } from 'react'
// query 查询字符串参数 字符串转为对象结构
const parseQuery = (search) => {
  search = search.replace('?', '')
  search = search.split('&')
  //   console.log(search)
  let obj = {}
  search.forEach((item) => {
    let tmp = item.split('=')
    obj[tmp[0]] = tmp[1]
  })
  return obj
}
export default class extends Component {
  render() {
    console.log(this.props)
    const { search } = this.props.location
    // 获取query 查询字符串参数
    console.log(this.props.location.search)
    console.log(parseQuery(search))

    return <div>新闻页面</div>
  }
}
